package top.cluski.feieprint.web;

import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import top.cluski.feieprint.domain.dto.MaiyationCreateOrderDTO;
import top.cluski.feieprint.service.MaiyatianService;

@RequestMapping("/maiyatian")
@RestController
public class MaiyatianController {

    @Resource
    MaiyatianService maiyatianService;

    @GetMapping("/callback")
    public String callback(@RequestParam String code) {
        maiyatianService.login(code);
        return "登录成功";
    }

    @GetMapping("refreshToken")
    public void refreshToken() {
        maiyatianService.refreshToken();
    }

    @GetMapping("getOrderList")
    public void getOrderList() {
        maiyatianService.getOrderList();
    }

    @PostMapping("order")
    public void createOrder(@RequestBody MaiyationCreateOrderDTO maiyationCreateOrderDTO) {
        maiyatianService.createOrder(maiyationCreateOrderDTO);
    }
}
